package com.neihe.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.neihe.entity.dto.admin.UpUserStatusDTO;
import com.neihe.entity.dto.admin.UserQueryPageDTO;
import com.neihe.entity.vo.admin.UserQueryPageVO;
import com.neihe.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * 管理员模块
 *
 * @author neihe
 * @since 2025-01-04
 */
@RestController
public class AdminController {

    @Autowired
    private IUserService userService;

    /**
     * 分页查询系统用户集合
     */
    @GetMapping("/api/admin/private/list")
    public IPage<UserQueryPageVO> getUserList(UserQueryPageDTO requestParam) {
        return userService.getUserList(requestParam);
    }

    /**
     * 修改用户状态
     */
    @PostMapping("/api/admin/private/up-status")
    public void upUserStatus(@Valid @RequestBody UpUserStatusDTO requestParam) {
        userService.upUserStatus(requestParam);
    }

}
